<?php
$on_login_page = true;
include("includes/common.php");
include("includes/login-helper.php");

if ($_POST["submit"]) {
  if (login($_POST["username"], $_POST["password"])) {
    $_SESSION['loggedin'] = true;
    $_SESSION["username"] = $_POST["username"];
    header("Location: index.php\r\n");
    exit();
  } else {
    $print_error_message = true;
  }
}

include("templates/login.tpl");
?>
